<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <title>promise链式调用</title>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
    <link rel='stylesheet' type='text/css' media='screen' href='main.css'>
    <script src='main.js'></script>
</head>
<body>
    
</body>
<script>
    let api = new Promise((resolve,reject)=>{
        setTimeout(()=>{
            if(true){
                resolve(10000)
            }else{
                reject()
            }
        },1000)
    })
    api.then(res=>{
        //若没有return，包装成promise对象,但是不带参数
        //若return,||promise类型 pending=>fulfilled
        //若return,promise类型,根据新的promise对象来决定fulfilled/rejected
        console.log('今年的奖金',res)
        // return res + 10000
        return new promise((resolve,reject)=>{})
    })
    .then(res=>{
        console.log('明年的奖金',res)
    })
    .catch()
</script>
</html>